import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)
// 获取原型对象push函数
const originalPush = VueRouter.prototype.push

// 获取原型对象replace函数
const originalReplace = VueRouter.prototype.replace

// 修改原型对象中的push函数
VueRouter.prototype.push = function push(location){
return originalPush.call(this , location).catch(err=>err)
}

// 修改原型对象中的replace函数
VueRouter.prototype.replace = function replace(location){
return originalReplace.call(this , location).catch(err=>err)
}
const routes = [
  {
    path: "/",
    name: "Home",
    component: () => import("@/pages/home/home.vue"),
    meta: {
      title: "主页",
    },
  },
  {
    path: "/supervisory",
    name: "Supervisory",
    component: () => import("@/pages/emergency/supervisory.vue"),
    meta: {
      title: '视频监控',
    },
  },
  {
    path: "/livelihoodIndex",
    name: "LivelihoodIndex",
    component: () => import("@/pages/livelihood/livelihoodIndex.vue"),
    meta: {
      title: '民生指数',
    },
  },
  {
    path: "/populationArea",
    name: "PopulationArea",
    component: () => import("@/pages/livelihood/populationArea.vue"),
    meta: {
      title: '人口区域',
    },
  },
  {
    path: "/waterMonitor",
    name: "WaterMonitor",
    component: () => import("@/pages/waterConservancyEnergy/waterMonitor.vue"),
    meta: {
      title: '水利监测',
    },
  },
  {
    path: "/energySupply",
    name: "EnergySupply",
    component: () => import("@/pages/waterConservancyEnergy/energySupply.vue"),
    meta: {
      title: '能源供给',
    },
  },
  {
    path: "/energyConsumption",
    name: "EnergyConsumption",
    component: () => import("@/pages/waterConservancyEnergy/energyConsumption.vue"),
    meta: {
      title: '电力消耗',
    },
  },
  {
    path: "/hydrogeography",
    name: "Hydrogeography",
    component: () => import("@/pages/cityOverview/hydrogeography.vue"),
    meta: {
      title: '水文地理',
    },
  },
  {
    path: "/pullUp",
    name: "PullUp",
    component: () => import("@/pages/intelligentTraffic/pullUp.vue"),
    meta: {
      title: '停车',
    },
  },
  {
    path: "/roadNetwork",
    name: "RoadNetwork",
    component: () => import("@/pages/intelligentTraffic/roadNetwork.vue"),
    meta: {
      title: '路网',
    },
  },
  {
    path: "/publicTransport",
    name: "PublicTransport",
    component: () => import("@/pages/intelligentTraffic/publicTransport.vue"),
    meta: {
      title: '公共交通',
    },
  },
  {
    path: "/passengerAnalysis",
    name: "PassengerAnalysis",
    component: () => import("@/pages/commercialEconomy/passengerAnalysis.vue"),
    meta: {
      title: '客流分析',
    },
  },
  {
    path: "/unreal",
    name: 'Unreal',
    component: () => import("@/views/PlayerView.vue"),
    meta: {
      title: '云流化',
    },
  }
]

const router = new VueRouter({
  routes
})

export default router
